function subform(form,target) {
        HTML_AJAX.formSubmit(form, target,{timeout:120000});
}
function replaceUrl(target,url) {
	HTML_AJAX.replace(target,url);
        return true;
}
function newwindow(url,name) {
	window.open(url,name,'height=200,width=400');
	if (window.focus) {newwindow.focus()}
}
function newprint(url,name) {
	window.open(url,name,'height=350,width=800,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function iprint(ptarget)
{
ptarget.focus();
ptarget.print();
}


function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
target.style.cursor = "default"
}
function modalwindow(title,url,w,h){
var properties = new Ext.Window({
		title:title,
		maximizable: true,
		autoLoad: url,
		modal:true,
		width:w,
		height:h,
		resizable:false
});
properties.show();
}
function idwindow(title,id,target,url,w,h){

var properties = new Ext.Window({
		title:title,
		id:id,
		autoLoad: url,
		modal:true,
		width:w,
		height:h,
		resizable:false
});
properties.show();
}
function idtargetwindow(title,id,target,w,h){

var properties = new Ext.Window({
		title:title,
		id:id,
		html: '<div id="'+target+'"></div>',
		width:w,
		height:h,
		resizable:false,
		autoScroll:true
});
properties.show();
}
function targetwindow(title,target,w,h){

var properties = new Ext.Window({
		title:title,
		html: '<div id="'+target+'"></div>',
		modal:true,
		width:w,
		height:h,
		resizable:false
});
properties.show();
return properties;
}
// Centro de Custos # Funcoes de calculo
function ArticleAmount(frmObj){
    /*
     * funcao antiga
     * var amnt = (frmObj.ArtQuantity.value*(frmObj.ArtUAmount.value-frmObj.ArtPromo.value))*((frmObj.ArtTaxPercent.value/100)+1);
document.edtCdcInvoice.ArtAmount.value = amnt.toFixed(2);
     */


if(frmObj.Type.value == 8) {
var amnt = ((frmObj.ArtUAmount.value-frmObj.ArtPromo.value))*((frmObj.ArtTaxPercent.value/100)+1);
document.edtCdcInvoice.ArtAmount.value = amnt.toFixed(2);
} else {
var amnt = (frmObj.ArtQuantity.value*(frmObj.ArtUAmount.value-frmObj.ArtPromo.value))*((frmObj.ArtTaxPercent.value/100)+1);
document.edtCdcInvoice.ArtAmount.value = amnt.toFixed(2);
}
}
function gridtoggle($rowid,$pointer){
    if(document.getElementById('row'+$rowid).innerHTML==''){
        replaceUrl('row'+$rowid,$pointer);
        document.getElementById('ico'+$rowid).src='_response/bin.php?get=Objects/Tree/minus.gif';
    }else{
        document.getElementById('row'+$rowid).innerHTML='';
        document.getElementById('ico'+$rowid).src='_response/bin.php?get=Objects/Tree/plus.gif';
    }
}
